/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-01
 * Time: 9:38
 */
interface NoParameterNoReturn {
    void test();
}
//无返回值一个参数
@FunctionalInterface
interface OneParameterNoReturn {
    void test(int a);
}
//无返回值多个参数
@FunctionalInterface
interface MoreParameterNoReturn {
    void test(int a,int b);
}
//有返回值无参数
@FunctionalInterface
interface NoParameterReturn {
    int test();
}
//有返回值一个参数
@FunctionalInterface
interface OneParameterReturn {
    int test(int a);
}
//有返回值多参数
@FunctionalInterface
interface MoreParameterReturn {
    int test(int a,int b);
}public class Demo {
    public static void main(String[] args) {
        MoreParameterReturn moreParameterReturn=((a,b)->{
            return a+b;
        });
        System.out.println(moreParameterReturn.test(10, 20));
        MoreParameterReturn moreParameterReturn2=((a,b)->a+b);
        System.out.println(moreParameterReturn2.test(30, 40));
    }
    public static void main5(String[] args) {
        OneParameterReturn oneParameterReturn=((a)->a);
        System.out.println(oneParameterReturn.test(10));
    }
    public static void main4(String[] args) {
       NoParameterReturn noParameterReturn=(()->{return 10;});
        System.out.println(noParameterReturn.test());
        NoParameterReturn noParameterReturn2=(()->100);
        System.out.println(noParameterReturn2.test());
    }
    public static void main3(String[] args) {
        MoreParameterNoReturn moreParameterNoReturn=((a,b)->{
            System.out.println(a+b );
        });
        moreParameterNoReturn.test(10,20);
    }
    public static void main2(String[] args) {
        OneParameterNoReturn oneParameterNoReturn=(a)->{
            System.out.println(a);
        };
        oneParameterNoReturn.test(10);
    }
    public static void main1(String[] args) {
        NoParameterNoReturn noParameterNoReturn2=new NoParameterNoReturn() {
            @Override
            public void test() {
                System.out.println("kkkkk");
            }
        };
        NoParameterNoReturn noParameterNoReturn=()->{
            System.out.println("haha");
        };
        noParameterNoReturn.test();
        noParameterNoReturn2.test();
    }
}
